import { createStore} from 'redux'

export function counterReducer(preState,action){
    const {type,data} = action
    if(type === 'increment'){
        return preState += data
    }
    if(type === 'decrement'){
        return preState -= data
    }
    return 0
}


const store = createStore(counterReducer)

export default store